package org.jackysoft.struts2;
import java.io.InputStream;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.stereotype.Controller;


@Controller
@Namespace("/")
public class ImageAction {
	private String inputName;
	private InputStream imageStream;
	
	@Action(value = "/images/px", 
			results = { 
			@Result(name = "success", 
					type = "stream", 
					params = {
			        "contentType", "image/jpeg",
			        "inputName","imageStream"		        
			})
			        })
    public String px(){
		imageStream  = Thread.currentThread().getContextClassLoader().getResourceAsStream("ext/px");
    	return "success";
    }

	public String getInputName() {
		return inputName;
	}

	public void setInputName(String inputName) {
		this.inputName = inputName;
	}

	public InputStream getImageStream() {
		return imageStream;
	}

	public void setImageStream(InputStream imageStream) {
		this.imageStream = imageStream;
	}
}
